<script type="text/javascript" src="<?= $this->config->base_url(); ?>assets/js/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="<?= $this->config->base_url(); ?>assets/js/jquery-ui.js"></script>
<link rel="stylesheet" href="<?= $this->config->base_url(); ?>assets/css/jquery-ui.css" type="text/css" charset="utf-8" />

<script>

$(function() {
        var scntDiv = $('#p_scents');
        var i = $('#p_scents tr').size() + 1;
     $('.addScnt').live('click', function() {
                $('<tr id="dd'+ i +'"> <td><input type="text" class="span8"  name="sl_no[]"  id="sl_no'+i+'" /></td>  <td><input type="text" class="span8" name="part_name[]" id="part_name'+i+'" /></td><td><input type="text" class="span8"  name="part_code[]"  id="part_code'+i+'" /></td> <td><input type="text" class="span8"  name="old_so[]"  id="old_so'+i+'" /></td><td><input type="text" class="span8"  name="new_so[]"  id="new _so'+i+'" /></td><td><a href="#" class="addScnt">ADD</a>&nbsp;&nbsp;&nbsp;<a href="#" id="'+i+'" class="remScnt">Remove</a></td></tr>').appendTo(scntDiv);
                i++;
                return false;
        });
        
        $('.remScnt').live('click', function() { 
       	
	            if( i > 2 ) {
                        
						$(this).parents('tr').remove();
                        i--;
                }
                return false;
		
        });
});










</script>

<div class="row-fluid">
<div class="span1">&nbsp;</div>
<div class="span10">
<h3 align="left">Collect SO No. For Defective SO</h3>
<form method="post" action="<?php echo site_url(); ?>/engineer/repair/defective_so">
<!--<div id="infoMessage"><?php echo $message;?></div>-->

<hr>

<input type="text" class="span2" name="case_no" readonly="readonly"value="<?php echo $case->case_no;?>"/>
<input type="hidden" name="case_id" value="<?php echo $case->id;?>"/>
<table width="100%" class="table table-bordered" >
  <tr class="info">
              <td><b>SL No.</b></td>
              <td><b>Part Name</b></td>
              <td><b>Part Code</b></td>
              <td><b>Old SO No.</b></td>
			   <td><b>New SO No.</b></td>
              <td><b>Options</b></td>
             </tr>
			
 <tbody id="p_scents">           
  <tr><label for="p_scnts">
  <?php $count=1;?>
  <?php foreach($defective_so as $defect){?>
  
    <td><input type="text" class="span8" name='sl_no[]' id="sl_no" value="<?php echo $count;?>" /></td>
	<input type="hidden" name="so_id[]" id="so_id" value="<?php echo $defect->id;?>"/>
    <td><input type="text" class="span8"  id="part_name"  name='part_name[]' value="<?php echo $defect->name;?>"/></td>
    <td><input type="text" class="span8" name="part_code[]" id="part_code" value="<?php echo $defect->code;?>"/></td>
    <td><input type="text" class="span8" name="old_so[]"  id="old_so" value="<?php echo $defect->so_no;?>" /></td>
	<td><input type="text" class="span8" name="new_so[]"  id="new_so" /></td>
  <td><a href="#" class="addScnt">ADD</a></td>
 </label> </tr>
 <input type="hidden" value="<?php echo $defect->docket_no;?>" name="docket_no"/>
 <?php $count=$count+1;?>
 <?php } ?>
  </tbody>
</table>
<br>
<br>
<p align="right"><?php echo form_submit('submit', 'Dispatch', 'class="btn btn-success"');?></p>
</form>
</div>

</div>



